1. Field of the Invention
This invention relates to devices and methods to process graphics and/or video data. More particularly, the present invention relates to improved devices and methods for compressing, storing, retrieving and uncompressing graphics and/or digital video data for display on a graphics and/or video display device.
2. Description of the Related Art
Low-end graphics and digital video, whether displayed on computer display terminals or television monitors, may utilize 8 bits per picture element (hereafter pixel). The use of 8 bits per pixel allows a maximum of 256 colors, which is often insufficient to accurately render the images to be displayed. Higher end graphics and digital video, on the other hand, may utilize 32 bits per pixel. In the red, green, blue (hereafter RGB) color space, 8 bits of the 32 bits per pixel are conventionally assigned to each of the three color components: 8 bits for each of the R, G and B color components. The remaining 8 bits of the 32 bits per pixel may be assigned to a special attribute, such as the transparency attribute. Use of the transparency attribute allows one graphics window, for example, to fade into another graphics window in a smooth manner or allows graceful fade ins or fade outs in digital video. Using 8 bits for the transparency attribute allows for 256 transparency levels. However, the use of 8 bits for each of the color components and 8 bits for the transparency attribute places great demands upon the graphics and/or video processing hardware. Indeed, a simple computation reveals that to store a relatively small 720xc3x97480 pixel graphics image using 32 bits per pixel requires 720xc3x97480xc3x9732 bits, or about 11 Mb of memory space. The demands placed upon the graphics and video processing hardware are even greater in the case of full motion video, as three video frames are often required to be temporarily stored in memory at any given time as part of the decompression process. There is, therefore, a need to reduce the memory requirements to process complex graphics and digital video data streams.
The memory, typically, may include a dynamic random access memory (hereafter DRAM) that may be external to the graphics and video processor. The graphics and digital video, therefore, must be transferred into and out of the external DRAM in a sufficiently rapid manner as to keep pace with the rate of the incoming and output data. Thus, the bandwidth of the graphics processorxe2x80x94external memory interface is also a significant consideration in the design of graphics and/or digital video processing devices. There is also a need, therefore, to devise methods and devices that reduce the need for high-bandwidth interfaces between the graphics processor and the external graphics/video DRAM. Ideally, such methods and devices should allow for the accurate representation of images with many colors (greater than 256, for example) without sacrificing the use of the transparency or other special attribute, all the while reducing the memory and bandwidth requirements of the graphics processing hardware.
The present invention, therefore, provides devices and methods for processing graphics and/or digital video that reduce the memory and bandwidth requirements of the graphics and video processing hardware, without unduly sacrificing image quality.
In accordance with the principles of the invention above and those that will be mentioned and will become apparent below, a method of processing graphics or digital video data, according to an embodiment of the present invention, comprises the steps of determining a source depth of each color component of a pixel of the data; selecting a stored depth of each color component of the pixel; selecting a stored depth of a special attribute for the pixel and compressing the color components of the pixel. The compressing step is carried out by performing a right shifting operation on each group of bits representing each color component by right shifting by a first number of bits equal to a difference between the source depth and the stored depth and transforming each right shifted group of bits by stripping all but a second number of least significant bits from each right shifted group, the second number being equal to the stored depth. A third number of bits is assigned to the special attribute, the third number being no greater than the selected stored depth of the special attribute. Each of the compressed color components of the pixel and the special attribute are then concatenated as concatenated pixel data and the concatenated pixel data is stored in a memory.
According to further embodiments, the concatenated pixel data may be retrieved from the memory and the retrieved concatenated pixel data may be uncompressed by left shifting each transformed group of the compressed data by a fourth number of bits and adding a correction factor thereto, the fourth number being equal to the difference between a selected read out depth and the stored depth. The correction factor may be selected so that the uncompressed data substantially matches the data prior to compression. The correction factor may be equal to a fifth number, the fifth number being equal to zero or 2 raised to the difference between the selected read out depth and the stored depth. The read out depth may be selected to be equal to the source depth of the data.
The color space of the data may be RGB. In that case, the determining, selecting, compressing and storing steps may be carried out for each of the R, G and B color components of the data. Alternatively, the color space of the data may be YCbCr and the determining, selecting, compressing and storing steps may then carried out for each of the Y, Cb and Cr color components of the data.
The color space of the data may be either YUV or YCbCr and the correction factor for the Cb, Cr, U and V components may be zero. The special attribute may represent or include pixel transparency data, for example.
The present invention is also a method of processing 24-bit digital video or graphics data, comprising the steps of allocating a 16 bit memory space of a memory to store each pixel of the 24-bit data; reducing a bit length of each color component of each pixel of the 24 bit data; allocating at least one bit within the 16 bit memory space to represent a special attribute distinct from the three bit-length reduced color components of each pixel of the 24-bit data; concatenating the bit length-reduced color components of each pixel and the special attribute as concatenated pixel data; storing the concatenated pixel data in the 16 bit memory space. The special attribute may include transparency data.
The color space of the 24-bit data may be RGB. In that case, the bit length reducing step may reduce an 8-bit red color component of the 24-bit data to 5 bits, an 8-bit green color component of the 24-bit data to 5 bits and an 8-bit blue color component of the 24-bit data to 4 bits and the allocating step may allocate 2 bits to the special attribute. Alternatively, the bit length reducing step may reduce an 8-bit red color component of the 24-bit data to 4 bits, an 8-bit green color component of the 24-bit data to 5 bits and an 8-bit blue color component of the 24-bit data to 4 bits and the allocating step may allocate 3 bits to the special attribute. The bit length reducing step may reduce an 8-bit red color component of the 24-bit data to 4 bits, an 8-bit green color component of the 24-bit data to 5 bits and an 8-bit blue color component of the 24-bit data to 3 bits and the allocating step may allocate 4 bits to the special attribute.
The color space of the 24-bit data may be YCbCr. In that case, the bit length reducing step may reduce an 8-bit Y color component of the 24-bit data to 5 bits, an 8-bit Cb color component of the 24-bit data to 5 bits and an 8-bit Cr color component of the 24-bit data to 4 bits and the allocating step may allocate 2 bits to the special attribute. The bit length reducing step may reduce an 8-bit Y color component of the 24-bit data to 5 bits, an 8-bit Cb color component of the 24-bit data to 4 bits and an 8-bit Cr color component of the 24-bit data to 5 bits and the allocating step may allocate 2 bits to the special attribute. The bit length reducing step may reduce an 8-bit Y color component of the 24-bit data to 6 bits, an 8-bit Cb color component of the 24-bit data to 4 bits and an 8-bit Cr color component of the 24-bit data to 4 bits and the allocating step may allocate 2 bits to the special attribute. The bit length reducing step may reduce an 8-bit Y color component of the 24-bit data to 6 bits, an 8-bit Cb color component of the 24-bit data to 4 bits and an 8-bit Cr color component of the 24-bit data to 3 bits and the allocating step may allocate 3 bits to the special attribute. The bit length reducing step may reduce an 8-bit Y color component of the 24-bit data to 6 bits, an 8-bit Cb color component of the 24-bit data to 3 bits and an 8-bit Cr color component of the 24-bit data to 4 bits and the allocating step may allocate 3 bits to the special attribute.
When the color space is RGB, the method may further include the steps of reading the bits stored in the 16 bit memory space; appending a 1 bit to the bits read from memory in a least significant bit position and appending at least one 0 bit to the appended 1 bit. When the color space is YCbCr, the method may further include the steps of reading the bits stored in the 16 bit memory space; appending, for the bits representing the color component corresponding to a Y component, a 1 bit to the bits read from memory in a least significant bit position and appending at least one 0 bit to the appended 1 bit; and appending, for the respective bits representing the color component corresponding to the Cb and Cr components, at least two 0 bits to the bits read from memory in a least significant bit position.
The present invention is also a three color component digital video and/or graphics data processing device, comprising a digital video and graphics data receiver, the receiver being adapted to receive data having a first number of bits assigned to transparency data and a second number of bits assigned to each of the three color components of the received data; dynamic random access memory; and a graphics processor coupled to the receiver and to the memory. The graphics processor includes logic to compress the data received from the receiver by reducing a number of bits allocated to represent pixel data in each of the three color components; store the transparency data and the compressed data in the memory; selectively retrieve the stored data from memory; and uncompress the retrieved data by selectively appending at least two least significant bits onto the retrieved data for each of the three color components, the appended bits representing a correction factor selected so that the uncompressed data substantially matches the data prior to compression.